<html> 
<head>
<script>
    function runTest()
    {
        if (window.testRunner)
            testRunner.dumpAsText();
        
        var ta = document.getElementById('ta');
        ta.focus();
        ta.setSelectionRange(4, 16);

        var lastSelectedLine;
        if (window.eventSender) {
            eventSender.keyDown("PageDown",["shiftKey"]);
            lastSelectedLine = (ta.value).substring(ta.selectionEnd - 4, ta.selectionEnd);
            eventSender.keyDown("ArrowUp",["shiftKey"]);
        }
        
        var result;
        var selectedText = (ta.value).substring(ta.selectionStart, ta.selectionEnd);
        if ((selectedText.indexOf(lastSelectedLine) == -1) && (selectedText.indexOf('L01') == -1))
            result = "SUCCESS: The selection shrunk correctly";
        else
            result = "SUCCESS: The selected text is \"" + selectedText + "\".";
        document.getElementById("result").firstChild.data = result; 
    }
</script>
</head>
<body onload="runTest()">
<p>This tests shrinking a selection with shift-up after extending it with shift-PageDown.</p>
<p style="color:green">
    This test does not run interactively.
    It uses the event sender to do mouse clicks.
    To run it manually, press shift-PagDown.  Then press shift-up.
    The selection should shrink by one line from the bottom after shift-up.
</p>
<textarea rows=10 id="ta">
L01
L02
L03
L04
L05
L06
L07
L08
L09
L10
L11
L12
L13
L14
L15
L16
</textarea>
<p id="result">TEST HAS NOT RUN</p>
</body>
